package com.solvePlat.service.Impl;

import com.solvePlat.dao.ResourceInfoUserMapper;
import com.solvePlat.entity.ResourceInfoUser;
import com.solvePlat.shiro.JWTToken;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.UUID;

@Service
public class ResourceInfoUseServiceImpl {
    @Resource
    private ResourceInfoUserMapper resourceInfoUserMapper ;

    public void  saveResourceInfo(ResourceInfoUser resourceInfoUser){
        JWTToken jwtToken = (JWTToken) SecurityUtils.getSubject().getPrincipal();
        resourceInfoUser.setUuid(UUID.randomUUID().toString());
        resourceInfoUser.setUserId(jwtToken.getUserId());


        resourceInfoUserMapper.insert(resourceInfoUser);
    }
}
